
(function(window,document,Laya){
	var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;

	var BaseExpression=interpreter.BaseExpression,Box=laya.ui.Box,CallExpression=interpreter.CallExpression;
	var ClassExpression=interpreter.ClassExpression,Event=laya.events.Event,FileManager=laya.ide.managers.FileManager;
	var FunctionExpression=interpreter.FunctionExpression,Handler=laya.utils.Handler,IDEAPIS=laya.ide.managers.IDEAPIS;
	var IdentifierExpression=interpreter.IdentifierExpression,Label=laya.ui.Label,LiteralExpression=interpreter.LiteralExpression;
	var MemberExpression=interpreter.MemberExpression,Paser=interpreter.Paser,PropsInputBase=laya.ide.props.PropsInputBase;
	var RenderSprite=laya.renders.RenderSprite,ResFileManager=laya.ide.managers.ResFileManager,Sprite=laya.display.Sprite;
	var TextInput=laya.ui.TextInput,View=laya.ui.View;
/**
*...
*@author ...
*/
//class laya.ide.props.ClassSprite extends laya.display.Sprite
var ClassSprite=(function(_super){
	function ClassSprite(js){
		this.jsInput=null;
		this.cls=null;
		ClassSprite.__super.call(this);
		this.jsInput=js;
		this.cls=js.cls;
	}

	__class(ClassSprite,'laya.ide.props.ClassSprite',_super);
	var __proto=ClassSprite.prototype;
	__proto.updateY=function(index,deltaY){
		var chs=this._childs;
		for (var i=index,n=chs.length;i < n;i++){
			var sprite=chs[i];
			sprite.y+=deltaY;
		}
	}

	/**
	*高度 h
	*/
	__proto.updateHeight=function(h){
		this.jsInput.freshSize();
	}

	/**
	*flush
	*/
	__proto.updateContent=function(){
		this.jsInput._value=this.jsInput.contentTxt.text=this.cls.toString();
		FileManager.createTxtFile(FileManager.getPath(IDEAPIS.assetsPath,this.jsInput._path),this.jsInput._value);
	}

	return ClassSprite;
})(Sprite)


/**
*...
*@author ...
*/
//class laya.ide.props.FuctionSprite extends laya.display.Sprite
var FuctionSprite=(function(_super){
	function FuctionSprite(fname){
		this.functionName=null;
		this.actionsSp=null;
		this.isopen=true;
		FuctionSprite.__super.call(this);
		this.actionsSp=new Sprite();
	}

	__class(FuctionSprite,'laya.ide.props.FuctionSprite',_super);
	var __proto=FuctionSprite.prototype;
	/**
	*设置方法的名字
	*@param name
	*/
	__proto.setName=function(name){
		var label=new Label();
		label.color="#ffffff";
		label.bold=true;
		label.text=name;
		this.addChild(label);
		this.functionName=label;
		this.functionName.on(/*laya.events.Event.CLICK*/"click",this,this.nameOnclick);
		this.addChild(this.actionsSp);
		this.actionsSp.y=label.height+2;
	}

	__proto.addAction=function(action){
		this.actionsSp.addChild(action);
		this.actionsSp.height+=action.height;
	}

	__proto.updateY=function(index,deltaY){
		var chs=this._childs;
		for (var i=index,n=chs.length;i < n;i++){
			var sprite=chs[i];
			sprite.y+=deltaY;
		}
	}

	/**
	*点击名字的
	*/
	__proto.nameOnclick=function(){
		var par=this.parent;
		if (this.isopen){
			this.actionsSp.visible=false;
			this.isopen=false;
			par.updateY(par.getChildIndex(this)+1,-this.actionsSp.height);
			par.height-=this.actionsSp.height;
		}
		else{
			this.actionsSp.visible=true;
			this.isopen=true;
			par.updateY(par.getChildIndex(this)+1,this.actionsSp.height);
			par.height+=this.actionsSp.height;
		}
	}

	return FuctionSprite;
})(Sprite)


//class laya.ide.props.ui.props.actionUI extends laya.ui.View
var actionUI=(function(_super){
	function actionUI(){
		this.obj=null;
		this.func=null;
		this.actionList=null;
		this.daction=null;
		this.upbtn=null;
		this.delbtn=null;
		this.downbtn=null;
		actionUI.__super.call(this);
	}

	__class(actionUI,'laya.ide.props.ui.props.actionUI',_super);
	var __proto=actionUI.prototype;
	__proto.createChildren=function(){
		laya.ui.Component.prototype.createChildren.call(this);
		this.createView(actionUI.uiView);
	}

	actionUI.uiView={"type":"View","props":{"width":285,"height":100},"compId":1,"child":[{"type":"Label","props":{"y":10,"x":13,"var":"obj","text":"a","color":"#ffffff"},"compId":8},{"type":"Label","props":{"y":10,"x":51,"var":"func","text":"pos","color":"#ffffff","bold":false},"compId":2},{"type":"List","props":{"y":12,"x":118,"width":78,"var":"actionList","repeatX":1,"height":69},"compId":5,"child":[{"type":"Box","props":{"renderType":"render","name":"render"},"compId":6,"child":[{"type":"TextInput","props":{"y":0,"x":0,"width":76,"text":"TextInput","skin":"comp/textinput.png","name":"param","height":22,"color":"#c5c5c5","sizeGrid":"3,3,3,3","padding":"0,5,0,5"},"compId":9}]}]},{"type":"Box","props":{"y":17.5,"x":240,"width":66,"visible":false,"var":"daction","height":58},"compId":13,"child":[{"type":"Button","props":{"y":-1,"x":-12,"width":15,"var":"upbtn","skin":"comp/button.png","label":"▲","height":15,"labelColors":"#efefef,#ffffff,#c5c5c5,#c5c5c5","sizeGrid":"0,4,0,4"},"compId":12},{"type":"Button","props":{"y":-1,"x":7,"width":15,"var":"delbtn","skin":"comp/button.png","label":"X","height":15,"labelColors":"#efefef,#ffffff,#c5c5c5,#c5c5c5","sizeGrid":"0,4,0,4"},"compId":10},{"type":"Button","props":{"y":-1,"x":27,"width":15,"var":"downbtn","skin":"comp/button.png","label":"▼","height":15,"labelColors":"#efefef,#ffffff,#c5c5c5,#c5c5c5","sizeGrid":"0,4,0,4"},"compId":11}]}]};
	return actionUI;
})(View)


//class laya.ide.props.ui.props.addActionUI extends laya.ui.View
var addActionUI=(function(_super){
	function addActionUI(){
		this.obj=null;
		this.save=null;
		this.func=null;
		this.params=null;
		addActionUI.__super.call(this);
	}

	__class(addActionUI,'laya.ide.props.ui.props.addActionUI',_super);
	var __proto=addActionUI.prototype;
	__proto.createChildren=function(){
		laya.ui.Component.prototype.createChildren.call(this);
		this.createView(addActionUI.uiView);
	}

	addActionUI.uiView={"type":"View","props":{"width":285,"height":80},"compId":1,"child":[{"type":"Label","props":{"y":10,"x":22,"var":"obj","text":"a","color":"#ffffff"},"compId":3},{"type":"Button","props":{"y":55,"x":1,"width":284,"var":"save","skin":"comp/button.png","label":"保存","height":23,"labelColors":"#efefef,#ffffff,#c5c5c5,#c5c5c5","sizeGrid":"0,4,0,4"},"compId":7},{"type":"ComboBox","props":{"y":10,"x":56,"width":74,"var":"func","skin":"comp/combobox.png","selectedIndex":0,"labels":"pos,scale","height":22,"sizeGrid":"0,20,0,4","labelColors":"#c5c5c5,#c5c5c5,#c5c5c5,#c5c5c5"},"compId":8},{"type":"Box","props":{"y":10,"x":165,"var":"params"},"compId":10,"child":[{"type":"TextInput","props":{"y":0,"width":91,"text":"TextInput","skin":"comp/textinput.png","name":"param","height":22,"color":"#c5c5c5","sizeGrid":"3,3,3,3","padding":"0,5,0,5"},"compId":4}]}]};
	return addActionUI;
})(View)


//class laya.ide.props.ui.props.addMethodUI extends laya.ui.View
var addMethodUI=(function(_super){
	function addMethodUI(){
		this.mName=null;
		this.addbtn=null;
		addMethodUI.__super.call(this);
	}

	__class(addMethodUI,'laya.ide.props.ui.props.addMethodUI',_super);
	var __proto=addMethodUI.prototype;
	__proto.createChildren=function(){
		laya.ui.Component.prototype.createChildren.call(this);
		this.createView(addMethodUI.uiView);
	}

	addMethodUI.uiView={"type":"View","props":{"width":285,"height":60},"compId":1,"child":[{"type":"ComboBox","props":{"y":19,"x":24,"var":"mName","skin":"comp/combobox.png","labels":"label1,label2","sizeGrid":"0,20,0,4","labelColors":"#c5c5c5,#c5c5c5,#c5c5c5,#c5c5c5"},"compId":2},{"type":"Button","props":{"y":17,"x":165,"var":"addbtn","skin":"comp/button.png","label":"add","labelColors":"#efefef,#ffffff,#c5c5c5,#c5c5c5","sizeGrid":"0,4,0,4"},"compId":3}]};
	return addMethodUI;
})(View)


/**
*...
*@author ...
*/
//class laya.ide.props.Action extends laya.ide.props.ui.props.actionUI
var Action=(function(_super){
	function Action(sp){
		this.clsSp=null;
		this.renderHandle=null;
		this.callExp=null;
		this.funExp=null;
		this.cindex=0;
		Action.__super.call(this);
		this.clsSp=sp;
		this.actionList.renderHandler=new Handler(this,this.listRender);
		this.on(/*laya.events.Event.MOUSE_OVER*/"mouseover",this,this._$7_onMouseOver);
		this.on(/*laya.events.Event.MOUSE_OUT*/"mouseout",this,this._$7_onMouseOut);
		this.upbtn.on(/*laya.events.Event.CLICK*/"click",this,this.onUpClick);
		this.downbtn.on(/*laya.events.Event.CLICK*/"click",this,this.ondownClick);
		this.delbtn.on(/*laya.events.Event.CLICK*/"click",this,this.ondelClick);
	}

	__class(Action,'laya.ide.props.Action',_super);
	var __proto=Action.prototype;
	__proto.onUpClick=function(){
		this.swithToSomeOne(this.cindex,this.cindex-1);
	}

	__proto.swithToSomeOne=function(from,to){
		this.parent.setChildIndex(this,to);
		var childs=this.parent._childs;
		var a=this.funExp.body;
		var fromC=a[from];
		a.splice(from,1);
		a.splice(to,0,fromC);
		if (from > to){
			var before=childs[to+1].y;
			for (var i=from;i > to;i--){
				var child=childs[i];
				child.y+=childs[from-1].height;
			}
			childs[to].y=before;
		}
		else{
			var before=childs[to-1].y;
			for (var i=from;i < to;i++){
				var child=childs[i];
				child.y-=childs[to].height;
			}
			childs[to].y=before;
		}
		this.clsSp.updateContent();
	}

	__proto.ondelClick=function(){
		this.funExp.body.splice(this.cindex,1);
		var childs=this.parent._childs;
		this.removeSelf();
		for (var i=this.cindex,n=childs.length;i < n;i++){
			childs[i].y-=this.height;
		}
		this.clsSp.updateContent();
	}

	__proto.ondownClick=function(){
		this.swithToSomeOne(this.cindex,this.cindex+1);
	}

	__proto._$7_onMouseOver=function(){
		if (this._graphics){
			this._renderType |=/*laya.renders.RenderSprite.GRAPHICS*/0x200;
			this.daction.visible=true;
			var i=this.parent.getChildIndex(this);
			this.cindex=i;
			this.upbtn.visible=(i !=0);
			this.downbtn.visible=(i !=this.parent._childs.length-1);
			this.repaint();
		}
	}

	__proto._$7_onMouseOut=function(){
		this._renderType &=~ /*laya.renders.RenderSprite.GRAPHICS*/0x200;
		this.daction.visible=false;
		this.repaint();
	}

	__proto.onDrap=function(e){
		if (e.data){
			e.target.text="o"+e.data.data.compId;
			this.callExp.callee.object=IdentifierExpression.create(e.target.text);
			this.clsSp.updateContent();
		}
	}

	//event("update");
	__proto.onClick=function(){}
	//debugger;
	__proto.updateData=function(callExp,fun,index){
		this.funExp=fun;
		this.cindex=index;
		this.callExp=callExp;
		var temp=(callExp.callee);
		this.obj.on("dragDrop",this,this.onDrap);
		this.obj.text=temp.object.toString();
		this.obj.on("click",this,this.onClick);
		console.log(">>>>>>>>>>width:"+this.obj.width+"height:"+this.obj.height);
		this.func.text=temp.property.toString();
		this.actionList.array=callExp.arguments;
		this.graphics.drawRect(0,0,this.width,this.height,null,"#ff0000");
		this._renderType &=~ /*laya.renders.RenderSprite.GRAPHICS*/0x200;
	}

	__proto.listRender=function(item,index){
		var param=item.getChildByName("param");
		if (param){
			param.on(/*laya.events.Event.BLUR*/"blur",this,this.changeParam,[index]);
			var d=this.callExp.arguments[index];
			param.text=d?d.toString():this.callExp.args[index];
		}
	}

	//this.height=actionList.height;
	__proto.onclick=function(){}
	__proto.changeParam=function(index,e){
		var d=this.callExp.arguments[index];
		this.callExp.args[index]=e.text;
		this.clsSp.updateContent();
	}

	return Action;
})(actionUI)


/**
*...
*@author ...
*/
//class laya.ide.props.AddAction extends laya.ide.props.ui.props.addActionUI
var AddAction=(function(_super){
	function AddAction(fun,fsp,rs){
		this.funcExp=null;
		this.callExp=null;
		this.objExp=null;
		this.proExp=null;
		this.fsp=null;
		this.clsSp=null;
		//params.removeChild();
		this.beforeIndex=0;
		AddAction.__super.call(this);
		this.funcExp=fun;
		this.fsp=fsp;
		this.clsSp=rs;
		this.save.on(/*laya.events.Event.CLICK*/"click",this,this.realAdd);
		this.obj.on("dragDrop",this,this.onDrap);
		this.obj.on("click",this,function(){
			debugger;
		});
		this.callExp=new CallExpression();
		this.objExp=IdentifierExpression.create("");
		this.proExp=IdentifierExpression.create("");
		this.callExp.callee=new MemberExpression(this.objExp,this.proExp);
		this.func.labels=AddAction.props.join(",");
		this.beforeIndex=-1;
		this.func.selectHandler=new Handler(this,this.onSeleted);
		this.func.selectedIndex=0;
	}

	__class(AddAction,'laya.ide.props.AddAction',_super);
	var __proto=AddAction.prototype;
	/*public function addparam():void{
	var t:TextInput=new TextInput();
	t.color="#ffffff";
	t.text="input";
	t.y=params._childs.length *24;
	t.size(91,22);
	params.addChild(t);
}*/


__proto.dele=function(){}
__proto.onSeleted=function(index){
	if (index !=this.beforeIndex){
		this.beforeIndex=index;
		var before=this.params._childs.length;
		var now=AddAction.settings[index].length
		this.recreateParam(before,now-before);
		this.resetText(AddAction.settings[index]);
	}

}


__proto.resetText=function(s){
	var pchilds=this.params._childs;
	for (var i=0,n=s.length;i < n;i++){
		var d=pchilds[i];
		d.text=s[i]?"abc":"123";
		d.restrict=s[i]?null:"[0-9]";
	}

}


__proto.recreateParam=function(before,detal){
	var i=0;
	if (detal > 0){
		for (i=0;i < detal;i++){
			var rs=AddAction.createParam();
			rs.y=(before+i)*25;
			this.params.addChild(rs);
		}
	}

	else if (detal < 0){
		for (i=0;i > detal;i--){
			before--;
			var t=this.params.removeChildAt(before);
			AddAction.paramPools.push(t);
		}
	}

}


__proto.realAdd=function(){
	var a=this.params._childs;
	for (var i=0,n=a.length;i < n;i++){
		var t=new LiteralExpression();
		var txt=a [i];
		if (txt.restrict){
			t.value=parseFloat(txt.text);
			t.raw=txt.text;
		}
		else{
			t.value=txt.text;
			t.raw='"'+txt.text+'"';
		}
		this.callExp.arguments.push(t);
		this.callExp.args.push(t.value);
	}

	this.objExp.name=this.obj.text;
	this.proExp.name=this.func.selectedLabel;
	this.funcExp.body.push(this.callExp);
	var action=new Action(this.clsSp);
	action.updateData(this.callExp,this.funcExp,this.funcExp.body.length);
	action.y=this.fsp.height;
	this.fsp.addAction(action);
	this.fsp.height+=action.height;
	this.y+=action.height;
	this.clsSp.updateY(this.clsSp.getChildIndex(this)+1,action.height);
	(this.clsSp.parent).height+=1000;
	this.clsSp.updateContent();
}


__proto.reset=function(){
	this.onSeleted(0);
}


__proto.onDrap=function(e){
	if (e.data){
		e.target.text="o"+e.data.data.compId;
	}

}


AddAction.createParam=function(){
	var rs=AddAction.paramPools.pop();
	if (!rs)rs=new TextInput();
	rs.color="#ffffff";
	rs.text="123";
	rs.size(91,22);
	return rs;
}


AddAction.paramPools=[];
__static(AddAction,
['props',function(){return this.props=["pos","scale","test"];},'settings',function(){return this.settings=[[0,0],[0,0],[0,0,0]];}
]);
return AddAction;
})(addActionUI)


/**
*...
*@author ...
*/
//class laya.ide.props.AddMethod extends laya.ide.props.ui.props.addMethodUI
var AddMethod=(function(_super){
	function AddMethod(cls){
		this.clsSp=null;
		AddMethod.__super.call(this);
		this.clsSp=cls;
		this.addbtn.on(/*laya.events.Event.CLICK*/"click",this,this.addMethod);
		this.mName.labels=AddMethod.list.join(",");
		this.mName.selectedIndex=0;
	}

	__class(AddMethod,'laya.ide.props.AddMethod',_super);
	var __proto=AddMethod.prototype;
	__proto.addMethod=function(){
		if (this.clsSp.cls.funMap[this.mName.selectedLabel]){
			alert("already exist");
			return;
		};
		var fun=new FunctionExpression();
		fun.name=this.mName.selectedLabel;
		this.clsSp.cls.addFun(fun.name,fun);
		var fsp=new FuctionSprite();
		var temp=this.clsSp.height;
		fsp.setName(fun.name);
		fsp.y=temp;
		temp+=20;
		var ah=0;
		temp+=ah;
		fsp.height=ah+20;
		var add=new AddAction(fun,fsp,this.clsSp);
		add.y=temp;
		this.clsSp.addChild(fsp);
		this.clsSp.addChild(add);
		this.clsSp.updateContent();
	}

	__static(AddMethod,
	['list',function(){return this.list=["onClick","onMouseDown","onMouseUp","onDrag","onTest"];}
	]);
	return AddMethod;
})(addMethodUI)


//class laya.ide.props.ui.props.JsonEditorInputUI extends laya.ide.props.PropsInputBase
var JsonEditorInputUI=(function(_super){
	function JsonEditorInputUI(){
		this.titleTxt=null;
		this.pathInputTxt=null;
		this.contentBox=null;
		this.contentTxt=null;
		this.saveBtn=null;
		this.className=null;
		JsonEditorInputUI.__super.call(this);
	}

	__class(JsonEditorInputUI,'laya.ide.props.ui.props.JsonEditorInputUI',_super);
	var __proto=JsonEditorInputUI.prototype;
	__proto.createChildren=function(){
		laya.ui.Component.prototype.createChildren.call(this);
		this.createView(JsonEditorInputUI.uiView);
	}

	JsonEditorInputUI.uiView={"type":"PropsInputBase","props":{"width":285,"height":550},"compId":1,"child":[{"type":"Label","props":{"y":8,"x":0,"width":84,"var":"titleTxt","text":"propsName","height":16,"color":"#efc9c9"},"compId":2},{"type":"TextInput","props":{"y":6,"var":"pathInputTxt","text":"TextInput","skin":"comp/input_22.png","right":0,"left":66,"height":22,"sizeGrid":"0,3,0,3","color":"#c5c5c5"},"compId":5},{"type":"Box","props":{"y":38,"var":"contentBox","right":0,"left":0},"compId":6,"child":[{"type":"TextArea","props":{"x":5,"var":"contentTxt","text":"content","skin":"comp/textarea.png","right":5,"left":5,"height":192,"editable":true,"color":"#aaaaaa","scrollBarSkin":"comp/vscroll.png","padding":"5,5,5,5","sizeGrid":"5,5,5,5"},"compId":3},{"type":"Button","props":{"y":200,"x":5,"var":"saveBtn","skin":"comp/btn.png","right":5,"label":"Save","labelColors":"#efefef,#ffffff,#c5c5c5,#c5c5c5","sizeGrid":"0,4,0,4"},"compId":4}]},{"type":"Label","props":{"y":244,"x":17,"text":"class","color":"#f6f4f4"},"compId":7},{"type":"TextInput","props":{"y":239,"x":59,"var":"className","text":"TextInput","skin":"comp/textinput.png","color":"#c5c5c5","sizeGrid":"3,3,3,3","padding":"0,5,0,5"},"compId":8}]};
	return JsonEditorInputUI;
})(PropsInputBase)


/**
*...
*@author ww
*/
//class laya.ide.props.MagicInput extends laya.ide.props.PropsInputBase
var MagicInput=(function(_super){
	function MagicInput(){
		this.input=null;
		this.rec=null;
		this.curValue=null;
		this.isSettingValue=false;
		MagicInput.__super.call(this);
		this.isFixHeight=true;
		this.useIDELabel=true;
		this.input=new TextInput();
		this.input.skin="comp/input_22.png";
		this.input.left=this.input.top=this.input.bottom=0;
		this.input.right=20;
		this.addChild(this.input);
		this.input.on(/*laya.events.Event.ENTER*/"enter",this,this.onInputValueChange);
		this.input.on(/*laya.events.Event.BLUR*/"blur",this,this.onInputValueChange);
		this.input.color="#ff0000";
		this.rec=new Box();
		this.rec.graphics.drawRect(0,0,20,20,"#00ff00");
		this.rec.size(20,20);
		this.rec.right=0;
		this.addChild(this.rec);
		this.rec.on(/*laya.events.Event.MOUSE_DOWN*/"mousedown",this,this.onDoubleClick);
	}

	__class(MagicInput,'laya.ide.props.MagicInput',_super);
	var __proto=MagicInput.prototype;
	__proto.onDoubleClick=function(){
		var preValue=0;
		preValue=parseInt(this.input.text);
		if (preValue){
			this.input.text=preValue *2+"";
			this.onInputValueChange();
		}
	}

	__proto.setTarget=function(target){
		_super.prototype.setTarget.call(this,target);
		this.curValue=target.props[this.valueKey];
		this.freshUI();
	}

	__proto.freshUI=function(){
		this.isSettingValue=true;
		this.input.text=this.curValue;
		this.isSettingValue=false;
	}

	__proto.onInputValueChange=function(){
		if (this.input.text !=this.curValue){
			this.curValue=this.input.text;
			if (this.isSettingValue)return;
			this.target.props[this.valueKey]=this.curValue;
			this.valueChange(this.valueKey,this.curValue,false);
		}
	}

	__proto.initByConfig=function(configO){
		_super.prototype.initByConfig.call(this,configO);
	}

	MagicInput.__init$=function(){
		PropsInputBase.regPlugin("magicinput",MagicInput);;
	}

	return MagicInput;
})(PropsInputBase)


/**
*...
*@author ww
*/
//class laya.ide.props.JsonEditorInput extends laya.ide.props.ui.props.JsonEditorInputUI
var JsonEditorInput=(function(_super){
	function JsonEditorInput(){
		this._value=null;
		this._path=null;
		this.cls=null;
		this._height=0;
		JsonEditorInput.__super.call(this);
		this.isFixHeight=false;
		this.useIDELabel=false;
		this.contentTxt.on(/*laya.events.Event.ENTER*/"enter",this,this.onTextChange);
		this.contentTxt.on(/*laya.events.Event.BLUR*/"blur",this,this.onTextChange);
		this.saveBtn.on(/*laya.events.Event.CLICK*/"click",this,this.onSaveBtn);
		this.pathInputTxt.on("dragDrop",this,this.onDragDrop);
		this.className.on(/*laya.events.Event.BLUR*/"blur",this,this.xx);
	}

	__class(JsonEditorInput,'laya.ide.props.JsonEditorInput',_super);
	var __proto=JsonEditorInput.prototype;
	__proto.xx=function(){
		this.cls.name=this.className.text;
		this._value=this.contentTxt.text=this.cls.toString();
	}

	__proto.onSaveBtn=function(){
		this._value=this.contentTxt.text;
		FileManager.createTxtFile(FileManager.getPath(IDEAPIS.assetsPath,this._path),this._value);
		this.saveBtn.visible=false;
	}

	__proto.onDragDrop=function(e){
		var dataO;
		dataO=e.data;
		if (!dataO)return;
		if (!dataO.type=="res")return;
		var asset;
		asset=dataO.asset;
		if (!asset)return;
		var rPath;
		rPath=FileManager.getRelativePath(IDEAPIS.assetsPath,asset);
		this.setPath(rPath);
		this.valueChange(this.valueKey,rPath);
	}

	__proto.setTarget=function(target){
		laya.ide.props.PropsInputBase.prototype.setTarget.call(this,target);
		this.titleTxt.text=this.valueKey;
		this.setPath(target.props[this.valueKey]);
		this.freshUI();
	}

	__proto.setPath=function(path){
		this._path=path;
		this.freshUI();
	}

	__proto.onTextChange=function(){
		if (this.contentTxt !=this._value){
			this.saveBtn.visible=true;
		}
	}

	__proto.freshUI=function(){
		this.pathInputTxt.text=this._path || "";
		if (this._path){
			var filePath;
			filePath=ResFileManager.getIDEResPath(this._path);
			if (FileManager.exists(filePath)){
				this.setState(true);
				this._value=FileManager.readTxtFile(filePath);
				this.contentTxt.text=this._value;
				this.cls=this.cls||Paser.parseALL(this._value);
				if (this.cls){
					if (this.className.text !=this.cls.name){
						this.className.text=this.cls.name;
						var sp=this.showFunction();
						this.addChild(sp);
					}
				}
				this.saveBtn.visible=false;
				return;
			}
		}
		this.setState(false);
	}

	__proto.showFunction=function(){
		var rs;
		var i=0;
		var beforeY=this.saveBtn.y;
		var temp=0;
		if (this.cls){
			var n=0;
			rs=new ClassSprite(this);
			rs.y=beforeY+80;
			var funs=this.cls.funs;
			for (i=0,n=funs.length;i < n;i++){
				var fun=funs[i];
				var fsp=new FuctionSprite();
				fsp.setName(fun.name);
				fsp.y=temp;
				temp+=20;
				var bocks=fun.body;
				var ah=0;
				for (var j=0,m=bocks.length;j < m;j++){
					var b=bocks[j];
					if ((b instanceof interpreter.CallExpression )){
						var action=new Action(rs);
						fsp.addAction(action);
						action.updateData(b,fun,i);
						action.y=ah;
						ah+=action.height;
					}
				}
				temp+=ah;
				fsp.height=ah+20;
				var add=new AddAction(fun,fsp,rs);
				add.y=temp;
				rs.addChild(fsp);
				rs.addChild(add);
				temp+=add.height;
			}
		}
		this.height+=80 *i;
		rs.width=this.width;
		var addMethod=new AddMethod(rs);
		addMethod.y=temp;
		rs.addChild(addMethod);
		rs.height=temp;
		this._$8__height=temp+beforeY;
		return rs;
	}

	__proto.setState=function(hasContent){
		if (hasContent){
			this.contentBox.visible=true;
			this.height=1800;
			}else{
			this.contentBox.visible=false;
			this.height=32;
		}
		this.freshSize();
	}

	__proto.initByConfig=function(configO){
		laya.ide.props.PropsInputBase.prototype.initByConfig.call(this,configO);
	}

	JsonEditorInput.__init$=function(){
		PropsInputBase.regPlugin("texteditor",JsonEditorInput);;;;
	}

	return JsonEditorInput;
})(JsonEditorInputUI)


	Laya.__init([MagicInput,JsonEditorInput]);
})(window,document,Laya);

if (typeof define === 'function' && define.amd){
	define('laya.core', ['require', "exports"], function(require, exports) {
        'use strict';
        Object.defineProperty(exports, '__esModule', { value: true });
        for (var i in Laya) {
			var o = Laya[i];
            o && o.__isclass && (exports[i] = o);
        }
    });
}